﻿using Shop.RemoteModel;
using Shop.RemoteModel.AdvertPlace;
using Shop.RemoteModel.AdvertPlace.Model;
using Shop.StoreGatewayModular.Interface;
using WeDonekRpc.Client;
using WeDonekRpc.HttpApiGateway.Model;

namespace Shop.StoreGatewayModular.Service
{
    internal class AdvertPlaceService : IAdvertPlaceService
    {
        public long Add ( AdvertPlaceAdd add )
        {
            return new AddAdvertPlace
            {
                Datum = add
            }.Send();
        }
        public PagingResult<AdvertPlaceDto> Query ( PagingParam<AdvertPlaceQueryParam> obj )
        {
            return new QueryAdvertPlace
            {
                Index = obj.Index,
                Size = obj.Size,
                SortName = obj.SortName,
                IsDesc = obj.IsDesc,
                NextId = obj.NextId,
                QueryParam = obj.Query
            }.Send();
        }
        public AdvertPlaceItem[] GetItems ( AdvertPlaceGetParam query )
        {
            return new GetAdvertPlaceItems
            {
                Param = query
            }.Send();
        }
        public AdvertPlaceConfig GetConfig ( long id )
        {
            return new GetAdvertPlaceConfig
            {
                Id = id
            }.Send();
        }
        public bool Set ( long id, AdvertPlaceSet set )
        {
            return new SetAdvertPlace
            {
                Id = id,
                Datum = set
            }.Send();
        }
        public AdvertPlaceDto[] Gets ( AdvertPlaceStatus? status )
        {
            return new GetsAdvertPlace
            {
                Status = status
            }.Send();
        }
        public void Delete ( long id )
        {
            new DeleteAdvertPlace
            {
                Id = id
            }.Send();
        }
        public AdvertPlace Get ( long id )
        {
            return new GetAdvertPlace
            {
                Id = id
            }.Send();
        }

        public void Enable ( long id )
        {
            new EnableAdvertPlace
            {
                Id = id
            }.Send();
        }

        public void Stop ( long id )
        {
            new StopAdvertPlace
            {
                Id = id
            }.Send();
        }

        public Dictionary<long, string> GetExampleImg ( string[] placeType )
        {
            return new GetPlaceExampleImg
            {
                PlaceType = placeType
            }.Send();
        }
    }
}
